﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace homework1
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void Form1_Load(object sender, EventArgs e)
        {

        }

        private void label1_Click_1(object sender, EventArgs e)
        {

        }

        private void button1_Click(object sender, EventArgs e)
        {
            string shuzu = textBox1.Text;
            string[] sArray = shuzu.Split(' ');
            int n = sArray.Length;
            int[] math = new int[n];
            for (int i = 0; i < n; i++)
            {
                int t = int.Parse(sArray[i]);
                math[i] = t;
            }
            int max = math.Max();
            int min = math.Min();
            int aver = (int)math.Average();
            int sum = math.Sum();

            label2.Text = "结果:" + " 最大值 " + max + " 最小值 " + min + " 平均值 " + aver + " 和 " + sum;
        }

        private void label2_Click(object sender, EventArgs e)
        {

        }
    }
}
